#ifndef ITEMWIDGET
#define ITEMWIDGET

#include "common/baseeditor.h"
#include "iw_additem.h"

namespace Ui {
class ItemWidget;
}

class ItemWidget : public BaseEditor
{
    Q_OBJECT

public:
    explicit ItemWidget(QWidget *parent,
                        const QString &table_,
                        const QString &category_);
    ~ItemWidget();

    void generateMenu();
    void updateView();
    void newItem();
    void save();
    void do_changeStatus();
    void do_cancelCategory();

protected:
    void keyPressEvent(QKeyEvent *event);

private slots:
    void on_tableView_clicked(const QModelIndex &index);
    void on_tableView_doubleClicked(const QModelIndex &);

private:
    Ui::ItemWidget *ui;

    int selectId;
    QString category;
    QString selectDate;
    QString previousDetail;
};

#endif // ITEMWIDGET
